<?php
/**
 * Created by PhpStorm.
 * User: Lesky
 * Date: 2020/6/22
 * Time: 9:33
 */

namespace App\Models;

use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Model;

class Base extends Model
{

    /**
     * author:lesky
     */

    public function addAll(Array $data)
    {
        try{
            $res = DB::table($this->getTable())->insert($data);
        }catch (\Exception $e){
            var_dump($e->getMessage());
//            return [];
        }
        return $res;
    }

    public  function getInfoByIds($ids){
        try{
            $res = DB::table($this->getTable())
                ->whereIn('id', $ids)
                ->get()->toArray();
        }catch (\Exception $e){
            return [];
        }
       return $res;
    }



}